package com.oocl.pmsystem.bean;

/**
 * 账户信息Bean类
 * 
 * @author WUJA13
 * 
 */
public class Person {

	public static int CURRENT_ID = 0;

	private int id = -1;// /非空，自增
	private String name;// /非空
	private String sex;// /性别： Male, Female
	private String address;// /住址
	private String birthday;// /生日，如： 1999.12.31
	private String phone;// /电话号码

	public Person() {

	}

	public Person(String name, String sex, String birthday, String address,
			String call) {
		// // 输入的合法性判断
		this.setName(name);
		this.sex = sex;
		this.address = address;
		this.birthday = birthday;
		this.phone = call;

	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
		if (this.name == null || this.name.length() == 0)
			return;
		if (this.id < 0)
			this.id = ++CURRENT_ID;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getBirthday() {
		return birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Override
	public String toString() {
		// /利用长度可变的字符串容器StringBuilder进行打印前操作
		StringBuilder sb = new StringBuilder();
		sb.append("Person(").append(this.id).append(")-->  name:")
				.append(this.name).append(",     sex:").append(this.sex)
				.append(",     birthday:")
				.append((this.birthday != null) ? this.birthday : "NULL")
				.append(",     address:")
				.append((this.address != null) ? this.address : "NULL")
				.append(",     phone:")
				.append((this.phone != null) ? this.phone : "NULL");
		return sb.toString();
	}

}
